﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using HREntities;

namespace HrTest
{
    class Program
    {

        static void NoisyPayer(IPayable p, decimal amount)
        {
            Console.WriteLine("Just paid {0} some money {1:c}", p.Name, amount);
        }
        static void QuietListener(TaxEntity t, string text)
        {
            Console.WriteLine("the {0} property on {1} changed", text, t.Name);
        }
        static void LoudListener(TaxEntity t, string text)
        {
            Console.WriteLine("THE {0} PROPERTY on {1} CHANGED", text.ToUpper(), t.Name);
        }
    

        static void Main(string[] args)
        {

            Company c = new Company("Acme", "75-1234567");
            Employee e1 = new Employee("Zelda","456-89-1111");
            Employee e2 = new Employee("Aaron", "111-87-5588");

            c.changeEvents += LoudListener;
            c.changeEvents += QuietListener;

            e1.changeEvents += LoudListener;
            e2.changeEvents += QuietListener;

            c.Name = "New Acme";
            e1.Name = "new Zelda";
            e2.TaxID = new SSN("123-55-6666");

            c.Hire(e1);
            c.Hire(e2);

            Company sub = new Company("AcmeBrick", "11-1234567");
            sub.Hire(new Employee("Hank", "123-46-7895"));
            sub.Hire(new Dog());

            c.Hire(sub);

            decimal total = c.Pay(NoisyPayer);
        }
    }
}
